package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * 使用缓冲字符流
 */
public class PwDemo {
    public static void main(String[] args) throws FileNotFoundException {
        /*PrintWriter pw = new PrintWriter("./test.txt");
        pw.println("写信告诉我今天海是什么颜色");
        pw.println("灰色是不想说");
        System.out.println("写出完毕");
        pw.close();*/

        /*FileOutputStream fos = new FileOutputStream("./test.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw);
        pw.println("写信告诉我今天海是什么颜色");
        pw.println("写信告诉我今天海是什么颜色2");
        System.out.println("写出完毕");
        pw.close();*/

        FileOutputStream fos = new FileOutputStream("./test.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw);
        pw.println("写信告诉我今天海是什么颜色");
        pw.println(12222222);
        System.out.println("写出完毕");
        pw.close();
    }
}
